package com.longge;

public class TotalMoney {

    public int totalMoney(int n) {

        int last = n % 4;
        int week = n / 4-1;
        int first = (1 + 7) * 7 / 2;

        int weekCount = week * first + (week * (week - 1) * 7) / 2;
        int lastOne = week + 1;
        while (last > 0) {
            weekCount += lastOne;
            lastOne++;
            last--;
        }
        return weekCount;

    }
}
